<template>
	<view>
		<!-- banner图 -->
		<view class="uni-padding-wrap">
			<view class="page-section swiper">
				<view class="page-section-spacing">
					<swiper class="swiper" circular="true" indicator-dots="true" autoplay="true" interval="3500"
						duration="600">
						<swiper-item class="swiper-list" v-for="(item, index) in bannerList" :key="index">
							<view class="swiper-item uni-bg-red">
								<image class="swiper-img" :src="item.imageUrl" mode=""></image>
							</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
		</view>
		<view class='nav-list margin-top'>
			<navigator open-type="navigate" hover-class='none' :url="item.url"
				:class="'nav-li bg-headData' + (index+1)" v-for="(item, index) in headDataList" :key="index">
				<view class="nav-name">{{item.name}}</view>
			</navigator>
		</view>
		<image class="jn_img" src="../../static/home/home-image.png" mode="widthFix"></image>
		<home-search ref="homeSearchRef"></home-search>
		<tabbar-footer></tabbar-footer>
	</view>
</template>

<script>
	import tabbarFooter from '../tabbar/tabbar-footer.vue'
	import homeSearch from '../home/homeSearch.vue'
	export default {
		data() {
			return {
				bannerList: [{
						imageUrl: '../../static/home/banner-1.png'
					},
					{
						imageUrl: '../../static/home/banner-2.png'
					},
					{
						imageUrl: '../../static/home/banner-3.png'
					},
					{
						imageUrl: '../../static/home/banner-4.png'
					},
					{
						imageUrl: '../../static/home/banner-5.png'
					}
				],
				headDataList: [
					{
						url: '/pages/release/seeking-pets-list',
						name: '寻宠详情',
						color: ''
					},
					{
						url: '/pages/me/mySeekingPetsList',
						name: '我的寻宠',
						color: ''
					}
				]
			}
		},
		components: {
			tabbarFooter,
			homeSearch
		},
		onShow() {
			this.callHomeSearchData()
		},
		methods: {
			callHomeSearchData() {
				this.$nextTick(() => {
					if (this.$refs.homeSearchRef) {
						this.$refs.homeSearchRef.getData();
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.swiper-box {
		flex: 1;
	}
	
	.swiper-item {
		height: 100%;
	}
	
	.jn_img{
		width: 700rpx;
		display: block;
		margin: 15rpx auto;
		border-radius: 20rpx;
	}
	
	.nav-list {
		display: flex;
		flex-wrap: wrap;
		padding: 0px 40upx 0px;
		justify-content: space-between;
	}
	
	.nav-li {
		padding: 30upx;
		border-radius: 12upx;
		width: 45%;
		margin: 0 2.5% 40upx;
		background-image: url(https://s1.ax1x.com/2020/06/27/NyU04x.png);
		background-size: cover;
		background-position: center;
		position: relative;
		z-index: 1;
	}
	
	.nav-li::after {
		content: "";
		position: absolute;
		z-index: -1;
		background-color: inherit;
		width: 100%;
		height: 100%;
		left: 0;
		bottom: -10%;
		border-radius: 10upx;
		opacity: 0.2;
		transform: scale(0.9, 0.9);
	}
	
	.nav-name {
		font-size: 28upx;
		text-transform: Capitalize;
		margin-top: 20upx;
		position: relative;
	}
	
	.nav-name::before {
		content: "";
		position: absolute;
		display: block;
		width: 40upx;
		height: 6upx;
		background: #fff;
		bottom: 0;
		right: 0;
		opacity: 0.5;
	}
	
	.nav-name::after {
		content: "";
		position: absolute;
		display: block;
		width: 100upx;
		height: 1px;
		background: #fff;
		bottom: 0;
		right: 40upx;
		opacity: 0.3;
	}
	
	.nav-name::first-letter {
		font-weight: bold;
		font-size: 36upx;
		margin-right: 1px;
	}
	
	.bg-headData1 {
		background-color: #FF5656;
		color: #fff;
	}
	
	.bg-headData2 {
		background-color: #6F68DF;
		color: #fff;
	}
</style>
